<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>发起申请</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../static/css/xadmin.css">
    <link rel="stylesheet" href="../static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="../static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../static/js/xadmin.js"></script>
    <script src="../static/js/my.js"></script>

</head>

<body>
<div class="x-body" >
       <form class="layui-form">
   
   
           <div class="layui-form-item">
               <label for="username" class="layui-form-label">
                   <span class="x-red">*</span>员工编号
               </label>
               <div class="layui-input-inline">
                   <input type="text" id="userId" disabled  name="userId" required=""
                          autocomplete="off" class="layui-input">
               </div>
              
           </div>
   
           <div class="layui-form-item">
               <label for="username" class="layui-form-label">
                   <span class="x-red">*</span>姓名
               </label>
               <div class="layui-input-inline">
                   <input type="text" id="userName"  name="userName"  required="" lay-verify="userName"
                          autocomplete="off" class="layui-input">
               </div>
             
           </div>
		   
		   <div class="layui-form-item">
		       <label for="username" class="layui-form-label">
		          时间
		       </label>
		       <div class="layui-input-inline">
		           <input type="text" id="time"  name="time"  required="" lay-verify="time"
		                  autocomplete="off" class="layui-input">
		       </div>
		     
		   </div>
		   <div class="layui-form-item">
		       <label for="username" class="layui-form-label">
		          考勤类型
		       </label>
		       <div class="layui-input-inline">
		           <select id="type" name="type" lay-verify="type"style="width: 150px;height: 37px">
		               <option value="">考勤类型</option>
		               <option value="请假">请假</option>
		               <option value="调休">调休</option>
		           	
		           </select>
		       </div>
		     
		   </div>
		   
   
           <div class="layui-form-item">
               <label class="layui-form-label">
               </label>
               <button  class="layui-btn layui-btn-radius layui-btn-warm" lay-filter="add" lay-submit="">
                   确认申请
               </button>
           </div>
           <span id="info" style="color:red"></span>
       </form>
</div>

<script>
	//定义文档加载事件
	$(function(){
		//获取用户登录名
		var url=decodeURI( window.location.href);
		//解析url(分割字符串)
		var dd=url.split("=");
		$("#userId").val(dd[1].split("&")[0]);
		$("#userName").val(dd[2]);
		
	
	})
	
	
	
	
	
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

      
        //修改
        form.on('submit(add)', function(d){
          
            $.ajax({
			    async:false,
                url:address+"/check/applyAjax",
                type:"post",
                data:d.field,
                dataType:"json",//返回的数据类型
                success:function(data){
                   
                    //如果注册成功就跳转到登录页面
                    if(data.info=="成功")
                      // layer.close(layer.index);
				window.alert("申请成功！请等待管理员审核");
				//关闭弹窗
				  // 获得frame索引
				  var index = parent.layer.getFrameIndex(window.name);
				  //关闭当前frame
				  parent.layer.close(index);
				  //刷新
				  parent.window.location.href=parent.window.location.href;
	

                }

            })
            // window.alert("申请成功！请等待管理员审核");
			
        });
     
   

    });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>
